﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataLib.Accounts.Bus;
using System.Data;
using System.Collections;

namespace Ewts.Cumtomer
{
    public partial class UserListByCumid : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["cumid"] != null && Request["cumid"].ToString().Trim() != "")
            {
                bindData(Request["cumid"].ToString().Trim());
            }
        }

        protected void bindData(string cumid)
        {
            DataTable dt = new DataTable();
            DataLib.BLL.cum_aacounts bll = new DataLib.BLL.cum_aacounts();
            dt = bll.GetUserListByCumid(cumid);
            reptUser.DataSource = dt;
            reptUser.DataBind();
        }

        protected string GetAllRole(string userid)
        {
            string strrole = "";
            Role role = new Role();

            AccountsPrincipal newUser = new AccountsPrincipal(int.Parse(userid));
            ArrayList roles = newUser.Roles;
            for (int i = 0; i < roles.Count; i++)
            {               
                if(i>0)
                    strrole += ",";
                Hashtable hs = (Hashtable)roles[i];
                foreach (DictionaryEntry myDE in hs)
                {
                    strrole += myDE.Value;
                 }
            }
            return strrole;
        }
    }
}